<?php
include('includes/connection_settings.php');

echo "<h1>Users</h1>";

//Echos links to users
$table = mysql_query("SELECT username FROM users ORDER BY username ASC");
if (!isset($table)) {
 echo "<h1>Can't choose data from the table!</h1><p>" . mysql_error($connection) . "</p>";
 exit;
}

if (mysql_result($table, 0, 0) == "") {
 echo "<p>There is no users!</p>";
 include('includes/end.php');
 exit;
}

echo "<p>Choose the wanted user from the following list:</p>";

for ($i = 0; $i < mysql_num_rows($table); $i++) {
 echo "
<p id='user" . mysql_result($table, $i, 0) . "'>
 <span class='likeLink' onClick='showUser(\"" . mysql_result($table, $i, 0) . "\")'>" . mysql_result($table, $i, 0) . "</span>
</p>";
}

?>
